# 将图标文件转换为base64字符串
import base64

# 读取并转换图标
with open('mjx128.ico', 'rb') as f:
    icon_data = base64.b64encode(f.read())

# 直接创建icon_data.py文件
with open('icon_data.py', 'w') as f:
    f.write('# 图标的base64编码数据\n')
    f.write(f'ICON = {icon_data}\n\n')
    f.write('''def get_icon_file():
    import base64, tempfile, os
    icon_path = os.path.join(tempfile.gettempdir(), 'mjx_notepad_icon.ico')
    with open(icon_path, 'wb') as icon_file:
        icon_file.write(base64.b64decode(ICON))
    return icon_path
''') 